* for example. */
this.addBody(_("%s is inviting you to join %s").format(inviter.get_alias(), channel.get_identifier()));
- this.addButton('decline', _("Decline"));
- this.addButton('accept', _("Accept"));
+ this.addAction('decline', _("Decline"));
+ this.addAction('accept', _("Accept"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
this.setUrgency(MessageTray.Urgency.CRITICAL);
- this.addButton('reject', _("Decline"));
+ this.addAction('reject', _("Decline"));
/* translators: this is a button label (verb), not a noun */
- this.addButton('answer', _("Answer"));
+ this.addAction('answer', _("Answer"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
{ customContent: true });
this.setResident(true);
- this.addButton('decline', _("Decline"));
- this.addButton('accept', _("Accept"));
+ this.addAction('decline', _("Decline"));
+ this.addAction('accept', _("Accept"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
this.addActor(layout);
- this.addButton('decline', _("Decline"));
- this.addButton('accept', _("Accept"));
+ this.addAction('decline', _("Decline"));
+ this.addAction('accept', _("Accept"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
this._account = account;
- this.addButton('view', _("View account"));
+ this.addAction('view', _("View account"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
}
},
- // addButton:
- // @id: the action ID
- // @label: the label for the action's button
- //
- // Adds a button with the given @label to the notification. All
- // action buttons will appear in a single row at the bottom of
- // the notification.
- //
- // If the button is clicked, the notification will emit the
- // %action-invoked signal with @id as a parameter
- addButton: function(id, label) {
+ addButton: function(id, button) {
if (!this._buttonBox) {
let box = new St.BoxLayout({ style_class: 'notification-actions' });
this.setActionArea(box, { x_expand: false,
global.focus_manager.add_group(this._buttonBox);
}
+ this._buttonBox.add(button);
+ button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
+
+ this.updated();
+ return button;
+ },
+
+ // addAction:
+ // @id: the action ID
+ // @label: the label for the action's button
+ //
+ // Adds a button with the given @label to the notification. All
+ // action buttons will appear in a single row at the bottom of
+ // the notification.
+ //
+ // If the button is clicked, the notification will emit the
+ // %action-invoked signal with @id as a parameter
+ addAction: function(id, label) {
let button = new St.Button({ can_focus: true });
let iconName = strHasSuffix(id, '-symbolic') ? id : id + '-symbolic';
button.label = label;
}
- this._buttonBox.add(button);
- button.connect('clicked', Lang.bind(this, this._onActionInvoked, id));
-
- this.updated();
- return button;
+ return this.addButton(id, button);
},
setUrgency: function(urgency) {
this._emitActionInvoked(ndata.id, "default");
}));
else
- notification.addButton(actions[i], actions[i + 1]);
+ notification.addAction(actions[i], actions[i + 1]);
}
}
switch (hints.urgency) {
this._undoCallback = undoCallback;
if (undoCallback) {
- notification.addButton('system-undo', _("Undo"));
+ notification.addAction('system-undo', _("Undo"));
notification.connect('action-invoked', Lang.bind(this, this._onUndoClicked));
}
this._devicePath = device_path;
this.addBody(_("Device %s wants to pair with this computer").format(long_name));
- this.addButton('allow', _("Allow"));
- this.addButton('deny', _("Deny"));
+ this.addAction('allow', _("Allow"));
+ this.addAction('deny', _("Deny"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
if (action == 'allow')
this._devicePath = device_path;
this.addBody(_("Device %s wants access to the service '%s'").format(long_name, uuid));
- this.addButton('always-grant', _("Always grant access"));
- this.addButton('grant', _("Grant this time only"));
- this.addButton('reject', _("Reject"));
+ this.addAction('always-grant', _("Always grant access"));
+ this.addAction('grant', _("Grant this time only"));
+ this.addAction('reject', _("Reject"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
switch (action) {
this.addBody(_("Please confirm whether the Passkey '%06d' matches the one on the device.").format(pin));
/* Translators: this is the verb, not the noun */
- this.addButton('matches', _("Matches"));
- this.addButton('does-not-match', _("Does not match"));
+ this.addAction('matches', _("Matches"));
+ this.addAction('does-not-match', _("Does not match"));
this.connect('action-invoked', Lang.bind(this, function(self, action) {
if (action == 'matches')
}));
this.addActor(this._entry);
- let okButton = this.addButton('ok', _("OK"));
- this.addButton('cancel', _("Cancel"));
+ let okButton = this.addAction('ok', _("OK"));
+ this.addAction('cancel', _("Cancel"));
okButton.reactive = this._canActivateOkButton();
this._entry.clutter_text.connect('text-changed', Lang.bind(this, function() {